<?php

class Admin_Model_DbTable_LessionExam extends Zend_Db_Table_Abstract
{

    protected $_name = 'lession_exam';
    
    public function getAllLessionExam(){
    	return $this->fetchAll();
    }
    
    public function getExamByID($eID){
    	return $this->fetchRow("exam_id = $eID");
    }

    public function addLessionExam($eName,$eContent,$eAnswer,$eAnswerR,$studentID,$teacherID,$eMark,$skillID){
    	$data = array(
    			"exam_name"=>$eName,
    			"exam_content"=>$eContent,
    			"exam_answer"=>$eAnswer,
    			"exam_answer_right"=>$eAnswerR,
    			"student_id"=>$studentID,
    			"teacher_id"=>$teacherID,
    			"exam_mark"=>$eMark,
    			"skill_id"=>$skillID,
    			"status"=>0
    			);
    	return $this->insert($data);
    }
    
    public function updateLesionExam($eId,$eName,$eContent,$eAnswer,$eAnswerR,$studentID,$teacherID,$eMark,$skillID){
    	$data = array(
    			"exam_name"=>$eName,
    			"exam_content"=>$eContent,
    			"exam_answer"=>$eAnswer,
    			"exam_answer_right"=>$eAnswerR,
    			"student_id"=>$studentID,
    			"teacher_id"=>$teacherID,
    			"exam_mark"=>$eMark,
    			"skill_id"=>$skillID,
    			"status"=>0
    			);
    	return $this->update($data, "exam_id = $eId");
    }

}

